﻿ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.U2D;

public class Lesson17 : MonoBehaviour
{

    // Start is called before the first frame update
    void Start()
    {
        //加载图集(注意：需要引用命名空间 using UnityEngine.U2D;)
        SpriteAtlas sa = Resources.Load<SpriteAtlas>("Atlas");
        //从图集中加载指定名字的小图
        Sprite sprite = sa.GetSprite("bk");
        //获取设置图片资源
        Image img = this.GetComponent<Image>();
        img.sprite = sprite;
    }
}
